//
//  LMPartnerDetailViewController.m
//  LM
//
//  Created by Kien Tran on 2/5/13.
//  Copyright (c) 2013 Kien Tran. All rights reserved.
//

#import "LMPartnerDetailViewController.h"
#import "LMLocalPartner.h"
#import "LMEditingPartnerViewController.h"

@interface LMPartnerDetailViewController ()

@end

@implementation LMPartnerDetailViewController
@synthesize phoneTextField = _phoneTextField, facebookTextField = _facebookTextField, firstDatingLabel = _firstDatingLabel;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) viewWillAppear:(BOOL)animated {
    
    LMLocalPartner *partner = (LMLocalPartner *) self.localUser;
    
    self.phoneTextField.text = partner.phone ? partner.phone : @"";
    self.facebookTextField.text = partner.facebook ? partner.facebook : @"";
    self.firstDatingLabel.text = [partner getDatingFirstDateString];
    
    
    self.nameLabel.text = super.localUser.userName;
    
    self.sexLabel.text = super.localUser.sex ? @"Male" : @"Female";
    
    if (super.localUser.birthday) {
        self.birthdayLabel.text = [LMGlobalHelper stringWithDate:self.localUser.birthday];
    }
    
}
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:kPushToEditingLocalUser]) {
        LMEditingPartnerViewController *editingController = [segue destinationViewController];
        editingController.isEditingPartner = YES;
        editingController.localUser = self.localUser;
    }
}

@end
